/*
 * Copyright (C) 2017 Pingan, Inc. All Rights Reserved.
 */

package com.pingan.haofang.searchcloud.web.index.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.pingan.haofang.searchcloud.common.constants.WebConstants;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;

/**
 * 调度VO
 *
 * @author zhangbi617
 * @date 18/05/2017
 */
@ApiModel(description = "调度信息")
public class IndexScheduleVO {

    /**
     * 调度ID
     */
    @ApiModelProperty("调度ID")
    private Long id;

    /**
     * 运行类型 0：定时触发 1：人工触发
     *
     * @see com.pingan.haofang.searchcloud.index.constants.IndexBuildRunType
     */
    @ApiModelProperty("运行类型 0：定时触发 1：人工触发")
    private Integer runType;

    /**
     * 任务粒度 0：索引 1：数据源
     *
     * @see com.pingan.haofang.searchcloud.index.constants.IndexBuildGradingType
     */
    @ApiModelProperty("任务粒度 0：全索引 1：数据源")
    private Integer gradingType;

    /**
     * 数据源名称
     */
    @ApiModelProperty("数据源名称，全索引(gradingType为0)时为空")
    private String datasourceName;

    /**
     * 索引构建类型 0：基准 1：增量
     *
     * @see com.pingan.haofang.searchcloud.index.constants.IndexBuildType
     */
    @ApiModelProperty("索引构建类型 0：基准 1：增量")
    private Integer indexBuildType;

    /**
     * 执行状态 0：待执行 1：执行中 2：成功 3：失败
     *
     * @see com.pingan.haofang.searchcloud.index.constants.IndexBuildStatus
     */
    @ApiModelProperty("执行状态 0：待执行 1：执行中 2：成功 3：失败")
    private Integer status;

    /**
     * 启动时间
     */
    @ApiModelProperty(value = "启动时间，格式:yyyy-MM-dd HH:mm:ss", example = "2017-05-08 14:41:12")
    @JsonFormat(pattern = WebConstants.DATE_FORMAT, timezone = WebConstants.TIMEZONE)
    private Date startTime;

    /**
     * 实际执行开始时间
     */
    @ApiModelProperty(value = "实际执行开始时间,格式:yyyy-MM-dd HH:mm:ss", example = "2017-05-08 14:41:12")
    @JsonFormat(pattern = WebConstants.DATE_FORMAT, timezone = WebConstants.TIMEZONE)
    private Date executeStartTime;

    /**
     * 实际执行结束时间
     */
    @ApiModelProperty(value = "实际执行结束时间,格式:yyyy-MM-dd HH:mm:ss", example = "2017-05-08 14:41:12")
    @JsonFormat(pattern = WebConstants.DATE_FORMAT, timezone = WebConstants.TIMEZONE)
    private Date executeEndTime;

    /**
     * 执行消耗总时间,单位:秒
     */
    @ApiModelProperty("执行消耗总时间,单位:秒")
    private long executeCostTime;

    /**
     * collection名称
     */
    @ApiModelProperty("collection名称")
    private String collectionName;

    /**
     * 抓取成功记录数
     */
    @ApiModelProperty("抓取成功记录数")
    private long fetchSuccessCount;

    /**
     * 抓取总记录数
     */
    @ApiModelProperty("抓取总记录数")
    private long fetchTotalCount;

    /**
     * 导入成功记录数
     */
    @ApiModelProperty("导入成功记录数")
    private long importSuccessCount;

    /**
     * 导入总记录数
     */
    @ApiModelProperty("导入总记录数")
    private long importTotalCount;

    /**
     * 配置快照
     */
    @ApiModelProperty("配置快照")
    private String configSnapshot;

    /**
     * 失败原因
     */
    @ApiModelProperty("失败原因")
    private String failReason;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Integer getRunType() {
        return runType;
    }

    public void setRunType(Integer runType) {
        this.runType = runType;
    }

    public Integer getIndexBuildType() {
        return indexBuildType;
    }

    public void setIndexBuildType(Integer indexBuildType) {
        this.indexBuildType = indexBuildType;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getExecuteStartTime() {
        return executeStartTime;
    }

    public void setExecuteStartTime(Date executeStartTime) {
        this.executeStartTime = executeStartTime;
    }

    public Date getExecuteEndTime() {
        return executeEndTime;
    }

    public void setExecuteEndTime(Date executeEndTime) {
        this.executeEndTime = executeEndTime;
    }

    public long getExecuteCostTime() {
        return executeCostTime;
    }

    public void setExecuteCostTime(long executeCostTime) {
        this.executeCostTime = executeCostTime;
    }

    public String getCollectionName() {
        return collectionName;
    }

    public void setCollectionName(String collectionName) {
        this.collectionName = collectionName;
    }

    public long getFetchSuccessCount() {
        return fetchSuccessCount;
    }

    public void setFetchSuccessCount(long fetchSuccessCount) {
        this.fetchSuccessCount = fetchSuccessCount;
    }

    public long getFetchTotalCount() {
        return fetchTotalCount;
    }

    public void setFetchTotalCount(long fetchTotalCount) {
        this.fetchTotalCount = fetchTotalCount;
    }

    public long getImportSuccessCount() {
        return importSuccessCount;
    }

    public void setImportSuccessCount(long importSuccessCount) {
        this.importSuccessCount = importSuccessCount;
    }

    public long getImportTotalCount() {
        return importTotalCount;
    }

    public void setImportTotalCount(long importTotalCount) {
        this.importTotalCount = importTotalCount;
    }

    public String getConfigSnapshot() {
        return configSnapshot;
    }

    public void setConfigSnapshot(String configSnapshot) {
        this.configSnapshot = configSnapshot;
    }

    public String getFailReason() {
        return failReason;
    }

    public void setFailReason(String failReason) {
        this.failReason = failReason;
    }

    public Integer getGradingType() {
        return gradingType;
    }

    public void setGradingType(Integer gradingType) {
        this.gradingType = gradingType;
    }

    public String getDatasourceName() {
        return datasourceName;
    }

    public void setDatasourceName(String datasourceName) {
        this.datasourceName = datasourceName;
    }

    @Override
    public String toString() {
        return "IndexScheduleVO{" +
                "id=" + id +
                ", runType=" + runType +
                ", gradingType=" + gradingType +
                ", datasourceName='" + datasourceName + '\'' +
                ", indexBuildType=" + indexBuildType +
                ", status=" + status +
                ", startTime=" + startTime +
                ", executeStartTime=" + executeStartTime +
                ", executeEndTime=" + executeEndTime +
                ", executeCostTime=" + executeCostTime +
                ", collectionName='" + collectionName + '\'' +
                ", fetchSuccessCount=" + fetchSuccessCount +
                ", fetchTotalCount=" + fetchTotalCount +
                ", importSuccessCount=" + importSuccessCount +
                ", importTotalCount=" + importTotalCount +
                ", configSnapshot='" + configSnapshot + '\'' +
                ", failReason='" + failReason + '\'' +
                '}';
    }
}
